/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package client.ui;

import java.util.LinkedList;
import java.util.Scanner;

/**
 *
 * @author Александр Емельянов (mr.lex91@gmail.com)
 */
public class Roster {
    private LinkedList<String> list=new LinkedList<String>();
    private String nickName;
    public Roster(String roster, int num, String nickName)
    {
        this.nickName=nickName;
        Scanner scan=new Scanner(roster);
        int i=0;
        while (i<num)
        {
            if (i!=num-1) list.add(scan.nextLine());
            else list.add(scan.next());
            i++;
        }
        list.remove(nickName);
    }
    public String[] getRoster()
    {
        String[] s=new String[list.size()];//=(String[]) list.toArray();
        list.toArray(s);
        return s;
    }
    public void addToList(String nickName)
    {
        list.add(nickName);
    }
    public void deleteFromList(String nickName)
    {
        list.remove(nickName);
    }
}
